{if $Think.session.identity == 1}{include file="./admin/view/public/header" /}
{else /}{include file="./teacher/view/public/header" /}
{/if}
<body>
<div class="page-group">
    <div class="page">
        <!-- 标题栏 -->
        <header class="bar bar-nav">
            <a class="icon icon-me pull-left open-panel"></a>
            <h1 class="title">签到管理</h1>
            <a class="button pull-right" href="{:url('/teacher/sign/studentlist')}">批量签到</a>
        </header>
        <!-- 工具栏 -->
        {if $Think.session.identity == 1}{include file="./admin/view/public/bar_menu" /}
        {else /}{include file="./teacher/view/public/bar_menu" /}
        {/if}
        <!-- 这里是页面内容区 -->
        <div class="content">
            <div class="content-block-title">查询学员签到记录</div>
            <div class="searchbar row" style="padding: 8px 15px;">
                <div class="search-input col-85">
                    <input type="search" id='search' placeholder='输入学员ID'/>
                </div>
                <a class="button button-fill button-primary col-15" onclick="findById()"><span class="icon icon-search"></span></a>
            </div>
            <div class="content-block-title">学员补签</div>
            <div class="list-block">
                <ul>
                    <!-- Text inputs -->
                    <li>
                        <div class="item-content">
                            <div class="item-inner">
                                <div class="item-title label">学员ID</div>
                                <div class="item-input">
                                    <input type="number" id="id" placeholder="输入学员ID">
                                </div>
                            </div>
                        </div>
                    </li>
                    <li>
                        <div class="item-content">
                            <div class="item-inner">
                                <div class="item-title label">补签日期</div>
                                <div class="item-input">
                                    <input type="text" id="date" value="2018-01-01" />
                                </div>
                            </div>
                        </div>
                    </li>
                    <!-- Select -->
                    <li>
                        <div class="item-content">
                            <div class="item-inner">
                                <div class="item-title label">补签次数</div>
                                <div class="item-input">
                                    <select id="count">
                                        <option value="1">1次</option>
                                        <option value="10">10次</option>
                                        <option value="20">20次</option>
                                    </select>
                                </div>
                            </div>
                        </div>
                    </li>
                </ul>
            </div>
            <a href="#" onclick="RemedySign()" class="button button-fill button-danger button-round">确定补签</a>
        </div>
    </div>
    <div class="popup">
        <div class="content-block">
            <p><a href="#" class="close-popup">点此关闭</a></p>
            <div class="list-block media-list" style="margin-top: -10px">
                <ul id="list">
                </ul>
            </div>
        </div>
    </div>
</div>
<!-- Left Panel -->
{if $Think.session.identity == 1}{include file="./admin/view/public/left_panel" /}
{else /}{include file="./teacher/view/public/left_panel" /}
{/if}

<!-- Js -->
{if $Think.session.identity == 1}{include file="./admin/view/public/foot" /}
{else /}{include file="./teacher/view/public/foot" /}
{/if}
<script>
    //日期组件
    $("#date").calendar({
        value: ['2018-01-01']
    });
    function findById() {
        var id = $('#search').val();
        $.ajax({
            url : '/teacher/remedy/findById',
            type : "get",
            dataType : "text",
            data : 'id='+id,
            success : function(data) {
                $('#list').append(JSON.parse(data));
                $.popup('.popup');
            },
            error : function(data) {
                console.log(data.response);
                $.alert('请求失败，服务器异常！');
            }
        });
    }
    function RemedySign() {
        var arr = {};
        arr.id = $('#id').val();
        arr.date = $('#date').val();
        arr.count = $('#count').val();
        console.log(JSON.stringify(arr));
        $.ajax({
            url : '/teacher/remedy/RemedySign',
            type : "post",
            dataType : "json",
            data : 'data='+JSON.stringify(arr),
            success : function(data) {
                $.alert(data.message);
            },
            error : function(data) {
                console.log(data.response);
                $.alert('请求失败，服务器异常！');
            }
        });
    }
</script>
</body>
</html>